#ifndef PM_PANEL_TASK_HISTORY_H_INCLUDED
#define PM_PANEL_TASK_HISTORY_H_INCLUDED

#include "paneltaskhistorygui.h"
#include "main.h"
#include "pm/taskhistory.h"

class PanelTaskHistory : public PanelTaskHistoryGui
{
	enum COLS_ALL {
		COL_ALL_UPDATE,
		COL_ALL_NAME,
		COL_ALL_UNIT_COST,
		COL_ALL_QUANTITY,
		COL_ALL_COST,
		COL_ALL_END_DATE
	};
	
	enum COLS_BY_DATE {
		COL_BY_DATE_UPDATE,
		COL_BY_DATE_NAME,
		COL_BY_DATE_UNIT_COST,
		COL_BY_DATE_QUANTITY,
		COL_BY_DATE_COST,
		COL_BY_DATE_COST_DONE,
		COL_BY_DATE_TOTAL_COST,
		COL_BY_DATE_END_DATE
	};
	
	enum COLS_BY_TASK {
		COL_BY_TASK_UPDATE,
		COL_BY_TASK_UNIT_COST,
		COL_BY_TASK_QUANTITY,
		COL_BY_TASK_COST,
		COL_BY_TASK_END_DATE
	};
	
	enum COLS_VS_INITIAL {
		COL_VS_INITIAL_NAME,
		COL_VS_INITIAL_TOTAL,
		COL_VS_INITIAL_INITAL,
		COL_VS_INITIAL_TODO,
		COL_VS_INITIAL_DONE
	};
	
	enum IMGS {
		IMG_DEFAULT,
		IMG_FINISH,
		IMG_ADD,
		IMG_OK,
		IMG_WARNING
	};
	
	wxImageList m_imgList;
	
public:
	PanelTaskHistory(wxWindow* parent);

protected:
	void ConnectPmEvents();
	void DisconnectPmEvents();

	wxDateTime GetDateByDate() const;
	
	void ReloadTaskChoice();

	void ReloadHistory();
	void AddTaskHistory(const pm::TaskHistory& task);
	void SetTaskHistory(long item, const pm::TaskHistory& task);

	void ReloadHistoryByDate();
	void AddTaskHistoryByDate(const pm::TaskAndCost& task);
	void SetTaskHistoryByDate(long item, const pm::TaskAndCost& task);

	void ReloadHistoryByTask();
	void AddTaskHistoryByTask(const pm::TaskHistory& task);
	void SetTaskHistoryByTask(long item, const pm::TaskHistory& task);
	
	void ReloadTasksVsInitial();
	void AddTaskVsInitial(const pm::TaskVsInitial& task);
	void SetTaskVsInitial(long item, const pm::TaskVsInitial& task);

	void OnConnectPmEvents(wxCommandEvent& event);
	void OnProjectLoaded(wxCommandEvent& event);
	
	void OnTaskChanged(pmEvent<pm::Task>& event);
	void OnTaskRemoved(pmEvent<db::ID>& event);
	void OnHistoryChanged(wxNotifyEvent& event);
	
	virtual void OnDateMinus( wxCommandEvent& event );
	virtual void OnChoiceMonth( wxCommandEvent& event );
	virtual void OnSpinYear( wxSpinEvent& event );
	virtual void OnDatePlus( wxCommandEvent& event );
	virtual void OnChoiceTask( wxCommandEvent& event );
};

#endif // PM_PANEL_TASK_HISTORY_H_INCLUDED
